<cfcomponent output="false">
	
	<!--- --->
	
	<cffunction name="initSite" access="public" output="false" returntype="any">
		<cfargument name="initSite" required="true" />
		
		<cfset var local = {} />
		
		<cfif arguments.initSite>
			<cfset application.applicationname = "fundr init" />
		</cfif>
		
		<cfif structKeyExists(application,"applicationname") and application.applicationname eq "fundr">
			<!--- do nothing --->
		<cfelse>
			<cfset structClear(application) />
			
			<cfset application.applicationname = "fundr" />
			<cfset application.core = this />
			<cfset application.path = "" />
			<cfset application.cfcpath = "" />
		
			<cfset initServices("alert,fund,login,pong,resource,user") />
			<cfset initGateways("fund,login,pong,resource,user") />
			<cfset initViews("fund,login,pong,topbar") />
			<cfset initVars() />
			<cfset initControllers() />
			<cfset initHelpers() />
			<cfset application.q.addMessage("Site Initted.") />
		</cfif>

	</cffunction>
	
	<!--- --->
	
	<cffunction name="initServices" access="private" output="false" returntype="void">
		<cfargument name="names" required="true" />
		
		<cfset var local = {} />
		
		<cfloop list="#arguments.names#" index="local.name">
			<cfset application.s['#local.name#Service'] = createObject('component','#application.cfcpath#cfcs.services.#local.name#Service') />
		</cfloop>

	</cffunction>
	
	<!--- --->
	
	<cffunction name="initGateways" access="private" output="false" returntype="void">
		<cfargument name="names" required="true" />
		
		<cfset var local = {} />
		
		<cfloop list="#arguments.names#" index="local.name">
			<cfset application.g['#local.name#Gateway'] = createObject('component','#application.cfcpath#cfcs.gateways.#local.name#Gateway') />
		</cfloop>

	</cffunction>
	
	<!--- --->
	
	<cffunction name="initViews" access="private" output="false" returntype="void">
		<cfargument name="names" required="true" />
		
		<cfset var local = {} />
		
		<cfloop list="#arguments.names#" index="local.name">
			<cfset application.v['#local.name#View'] = createObject('component','#application.cfcpath#cfcs.views.#local.name#View') />
		</cfloop>

	</cffunction>
	
	<!--- --->
	
	<cffunction name="initControllers" access="private" output="false" returntype="void">
		
		<cfset application.c.loginController = createObject('component','#application.cfcpath#cfcs.controllers.loginController')>
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="initHelpers" access="private" output="false" returntype="void">
		
		<cfset application.q = createObject('component','#application.cfcpath#cfcs.q') />
			
	</cffunction>
	
	<!--- --->
	
	<cffunction name="includeScripts" access="public" output="false" returntype="string">
		<cfset var local = {} />
		
		<cfsavecontent variable="local.result">
			<cfoutput>
				<link rel="stylesheet" href="#application.path#/assets/css/jquery-ui-1.10.1.custom.css">
				<script type="text/javascript" src="#application.path#/assets/js/libraries/jquery-1.9.1.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/libraries/jquery-ui-1.10.1.custom.min.js"></script>
				
				<!--- css --->
				<link rel="stylesheet" href="#application.path#/assets/css/left.css">
				<link rel="stylesheet" href="#application.path#/assets/css/fundr.css">
				<link rel="stylesheet" href="#application.path#/assets/css/fund.css">
				<link rel="stylesheet" href="#application.path#/assets/css/topbar.css">
				
				<!--- js --->
				<script type="text/javascript" src="#application.path#/assets/js/pong.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/fundr.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/login.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/validateWords.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/validate.js"></script>
				<script type="text/javascript" src="#application.path#/assets/js/valid.js"></script>
			</cfoutput>
		</cfsavecontent>
		
		<cfreturn local.result />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="initVars" access="public" output="false" returntype="void">
		
		<cfset application.vars = {} />
		<cfset application.vars.localpong = {} />
		<cfset application.vars.webpong = {} />
		<cfset application.vars.localfundr = {} />
		<cfset application.vars.webfundr = {} />
		
		<!--- localpong --->
		<cfset application.vars.localpong.app_id = '10068664166' />
		<cfset application.vars.localpong.app_secret = '3504e4e8711a7961f23d2714a8df70af' />
		<cfset application.vars.localpong.encryptKey = 'ru8femXhTm9jwdGd1234232352345xx22' />
		<cfset application.vars.localpong.homeURL = 'http://localhost:8888/pong.cfm' />
		<cfset application.vars.localpong.my_url = 'http://localhost:8888/cfcs/action.cfm?cfc=loginController&method=handleFacebookLogin' />
		
		<!--- webpong --->
		<cfset application.vars.webpong.app_id = '10068664166' />
		<cfset application.vars.webpong.app_secret = '3504e4e8711a7961f23d2714a8df70af' />
		<cfset application.vars.webpong.encryptKey = 'ru8femXhTm9jwdGd1234232352345xx22' />
		<cfset application.vars.webpong.homeURL = 'http://www.blokus.net/pong.cfm' />
		<cfset application.vars.webpong.my_url = 'http://www.blokus.net/cfcs/action.cfm?cfc=loginController&method=handleFacebookLogin' />
		
		<!--- localfundr --->
		<cfset application.vars.localfundr.app_id = '10068664166' />
		<cfset application.vars.localfundr.app_secret = '3504e4e8711a7961f23d2714a8df70af' />
		<cfset application.vars.localfundr.encryptKey = 'ru8femXhTm9jwdGd1234232352345xx22' />
		<cfset application.vars.localfundr.homeURL = 'http://localhost:8888/home.cfm' />
		<cfset application.vars.localfundr.my_url = 'http://localhost:8888/cfcs/action.cfm?cfc=loginController&method=handleFacebookLogin' />
		
		<!--- webfundr --->
		<cfset application.vars.webfundr.app_id = '10068664166' />
		<cfset application.vars.webfundr.app_secret = '3504e4e8711a7961f23d2714a8df70af' />
		<cfset application.vars.webfundr.encryptKey = 'ru8femXhTm9jwdGd1234232352345xx22' />
		<cfset application.vars.webfundr.homeURL = 'http://www.blokus.net/home.cfm' />
		<cfset application.vars.webfundr.my_url = 'http://www.blokus.net/cfcs/action.cfm?cfc=loginController&method=handleFacebookLogin' />
		
		<!--- identify database table settings --->
		<cfset application.vars.db = {} />
		<cfset application.vars.db.user = {name:"user",auto:"true",active:"true",timestamp:"true"} />
		<cfset application.vars.db.pong_rate_user = {name:"pong_rate_user",auto:"true",active:"false",timestamp:"true"} />
		<cfset application.vars.db.fund = {name:"fund",auto:"true",active:"true",timestamp:"true"} />
		<cfset application.vars.db.pong_vote = {name:"pong_vote",auto:"true",active:"false",timestamp:"true"} />
	</cffunction>
	
	<!--- --->


</cfcomponent>